﻿@* 
Project: Aguafrommars/TheIdServer
Copyright (c) 2022 @Olivier Lefebvre
*@
@using Microsoft.Extensions.Configuration
@inject SignInManager<ApplicationUser> SignInManager
@inject IViewLocalizer Localizer
@inject IConfiguration Configuration

@{    
    var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any();
}
<ul class="nav nav-pills flex-column">
    <li class="nav-item"><a class="nav-link @ManageNavPages.IndexNavClass(ViewContext)" asp-page="./Index">@Localizer["Profile"]</a></li>
    <li class="nav-item"><a class="nav-link @ManageNavPages.EmailNavClass(ViewContext)" id="email" asp-page="./Email">@Localizer["Email"]</a></li>
    <li class="nav-item"><a class="nav-link @ManageNavPages.ChangePasswordNavClass(ViewContext)" id="change-password" asp-page="./ChangePassword">@Localizer["Password"]</a></li>
    @if (hasExternalLogins)
    {
        <li class="nav-item"><a class="nav-link @ManageNavPages.ExternalLoginsNavClass(ViewContext)" id="external-login" asp-page="./ExternalLogins">@Localizer["External logins"]</a></li>
    }
    <li class="nav-item"><a class="nav-link @ManageNavPages.TwoFactorAuthenticationNavClass(ViewContext)" asp-page="./TwoFactorAuthentication">@Localizer["Two-factor authentication"]</a></li>
    <li class="nav-item"><a class="nav-link @ManageNavPages.PersonalDataNavClass(ViewContext)" asp-page="./PersonalData">@Localizer["Personal data"]</a></li>
    <li class="nav-item"><a class="nav-link @ManageNavPages.GrantsNavClass(ViewContext)" asp-page="./Grants">@Localizer["Grants"]</a></li>
    @if (!Url.Page("./Ciba").StartsWith("/?page"))
    {
        <li class="nav-item"><a class="nav-link @ManageNavPages.CibaNavClass(ViewContext)" asp-page="./Ciba">@Localizer["Backchannel Login Requests"]</a></li>
    }
    @if (Configuration.GetValue<bool>("IdentityServerOptions:EnableServerSideSession") && !Url.Page("./Sessions").StartsWith("/?page"))
    {
        <li class="nav-item"><a class="nav-link @ManageNavPages.SessionsNavClass(ViewContext)" asp-page="./Sessions">@Localizer["Sessions"]</a></li>
    }
</ul>
